package com.moons.settings.config;

import android.content.Context;
import android.os.Environment;

import java.io.File;
import java.io.Serializable;


public class DemoConfig implements Serializable {
    private static DemoConfig demoConfig = null;
    public static DemoConfig instance(){
        if(demoConfig==null){
            demoConfig = new DemoConfig();
        }
        return demoConfig;
    }

    private DemoConfig(){

    }
    //更新配置
    public void update(Context context){

    }
    //保存配置
    public void save(Context context){

    }

    public static final int FEATURE_LEN = 256;

    //本地数据目录
    public static final String RootPath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/ar_face_data/";
    //注册人脸图像路径
    public static final String FacePicPath = RootPath + "ar_face_pic/";
    //数据库路径
    public static final String DatabasePath = RootPath + "ar_face_db/";
    //抓拍路径
    public static final String CapturePath = RootPath + "ar_face_capture/";

    //需要配置的信息
    public float feature_threshold = 0.40f;  //特征阀值

    public String dev_uuid = "";  //设备UUID
    public String dev_position = "";  //设备位置

    public boolean useNativeDraw = true;
    public boolean isPortrait = true;  //竖屏模式

    public boolean captureFace = false;  //捕获人脸
    public boolean isLiveDetect = false;  //活体检测
    public boolean isShowFaceInfo = true;  //显示人脸信息
    public boolean uploadFace = false;  //上传人脸
    public String uploadAssress = "";  //上传地址
    public int faceMatchMode = 0;  //人脸匹配模式

    public boolean isCloudMode = false;  //是否云端模式
    public String appKey = "77ff60f887204201";
    public String appSecret = "c336269b237a42fb";
    public String cloudServerAddr = "39.107.245.211";
    public int cloudServerPort = 12002;

    public String cusUid = "";

    public int faceDetectMode = 0;  //0: 本地注册 1：UVC注册

    public boolean isPalySound = true;
    public int iSoundType = 0;

    public String postContent = "";

    public int cameraResolution = 2; //0:default 1:360p 2:720p 3:1080p
    public int cameraFps = 1; //0:default 1:25 2:30

    public boolean isCheckJpeg = false;
    public boolean enableQRCode = false;

    public boolean isUvcLiveness = false;

    //不需要配置的暂存信息
    public String uvcDeviceInfo = "";
    public boolean isDebugMode = false;
    public boolean isPrintLog = false;
    public String appVersionName = "";
    public boolean isCamConfigMode = false;
    // 更新存储数据的各个文件夹，确保都存在
    public void updateFolder() {
        File file = new File(DemoConfig.RootPath);
        if (!file.exists()) {
            file.mkdirs();
        }
        File file2 = new File(DemoConfig.FacePicPath);
        if (!file2.exists()) {
            file2.mkdirs();
        }
        File file3 = new File(DemoConfig.DatabasePath);
        if (!file3.exists()) {
            file3.mkdirs();
        }
        File file4 = new File(DemoConfig.CapturePath);
        if (!file4.exists()) {
            file4.mkdirs();
        }
    }
}
